function auth_config()
{
	var allow_sub = checkPost();
	if(allow_sub)
	{
		var datastr = allow_sub;
		var r = Math.random();
		$.ajax({
	        type: "POST",
	        url: "/admin/aj_publiclog.php?r=" + r,
	        data: "action=auth" + datastr,
	        dataType: "json",
	        success: function(json){
	            if(json.status) {
	            	showCommonLayer(json.msg, 4);
						location.href = 'public_log.php?op=auth';
						return;
	            } else {
	            	showCommonLayer(json.msg, 5);
	            }
	        }
	    }); 
	}
}

function refuse()
{
	var allow_sub = checkPost();
	if(allow_sub)
	{
		var datastr = allow_sub;
		var r = Math.random();
		$.ajax({
	        type: "POST",
	        url: "/admin/aj_publiclog.php?r=" + r,
	        data: "action=refuse" + datastr,
	        dataType: "json",
	        success: function(json){
	            if(json.status) {
	            	showCommonLayer(json.msg, 4);
						location.href = 'public_log.php?op=auth';
						return;
	            } else {
	            	showCommonLayer(json.msg, 5);
	            }
	        }
	    }); 
	}
	
}

//检查表单填写情况（除属性外，每一项都为必填）
function checkPost()
{
	//获取各查询条件
    var sql = $('textarea[name="SQL"]').val();	//主索引SQL语句
        sql = $.trim(sql);
    var id = $('input[name="id"]').val(); //要审核的配置ID
        id = parseInt($.trim(id));
	
	
    var datastr = '';
    if(id){
        datastr += '&id=' + id;
    } 
        datastr += '&sql=' + sql;
    return datastr;
}


